package com.example.orderservice.controller;


import com.example.orderservice.entity.Order;
import com.example.orderservice.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    // 创建订单接口
    @PostMapping("/create")
    public Order createOrder(
            @RequestParam String productId,
            @RequestParam int quantity
    ) {
        return orderService.createOrder(productId, quantity);
    }
}